package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.InvoiceRelationshipEntity;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * @author feng.zheng
 * @version v1.0
 * @date 2019/2/26 16:20
 * @since v1.0
 */

public interface InvoiceRelationshipDao {

    Integer insert(InvoiceRelationshipEntity invoiceRelationship);

    void batchInsert(List<InvoiceRelationshipEntity> list);

    void updateBatchSerialNo(List<InvoiceRelationshipEntity> list);

    /**
     * 批量更新金额
     * @param corpid
     * @param list
     * @throws
     * @author zcp
     * @since v1.0
     * @version v1.0
     */
    void updateBatchMoney(@Param("corpid") String corpid, @Param("list") List<InvoiceRelationshipEntity> list);

    Integer update(InvoiceRelationshipEntity invoiceRelationship);

    Integer updateByParam(@Param("param") Map<String, Object> param);

    Integer deleteByKey(@Param("key") Long key);

    InvoiceRelationshipEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);


    List<InvoiceRelationshipEntity> findEntitys(@Param("param") Map<String, Object> param);

    Integer getEntitysCount(@Param("param") Map<String, Object> param);


    List<InvoiceRelationshipEntity> getByInvId(@Param("invoiceId") Long id, @Param("corpid") String corpid);

    Integer deleteByInvoiceId(@Param("invoiceId") Long id, @Param("corpid") String corpid);

    Integer deleteByInvoiceIdIn(@Param("invoiceIdIn") List<Long> invoiceIdIn, @Param("corpid") String corpid);

    Integer deleteByParam(@Param("param") Map<String, Object> param);

    List<InvoiceRelationshipEntity> getByParam(@Param("param") Map<String, Object> map);

    void updateIsCancel(@Param("isCancel") Integer isCancel, @Param("param") Map<String, Object> param);

    List<Map<String, Object>> getSumMoneyOfContract(@Param("param") Map<String, Object> param);

    List<Map<String, Object>> getSumMoneyOfPayment(@Param("param") Map<String, Object> param);

    List<Map<String, Object>> getSumMoneyOfPaymentSheet(@Param("param") Map<String, Object> param);

    List<Integer> findInvoiceId(@Param("param") Map<String, Object> modelMap);

    Map<String, Object> getSummary(@Param("param") Map<String, Object> invoiceMap);

    void updateApprove(@Param("approveStatus") Integer approveStatus, @Param("param") Map<String, Object> param);

    Integer getCountPaymentOrContract(@Param("param") Map<String, Object> param);

    Integer getCountPayment(@Param("param") Map<String, Object> param);

    Integer getCountPaymentSheet(@Param("param") Map<String, Object> param);
}
